<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('窗口人员统计列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>

                            <li>
                                <label>请选择窗口人员：</label>
                                <select  class="form-control" name="ryid" th:with="type=${@dict.getType('sys_ck_user')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}">
                                    </option>
                                </select>
                            </li>
                            <li>
                                <label>开始时间：</label>
                                <input type="text" class="form-control" name="startTime" id="startTime"
                                       placeholder="开始时间"/>
                            </li>
                            <li>
                                <label> 结束时间：</label>
                                <input type="text" class="form-control" name="endTime" id="endTime"
                                       placeholder="截止时间"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:cktongji:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:cktongji:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:cktongji:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:cktongji:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
     <th:block th:include="include :: footer"/>
     <th:block th:include="include :: datetimepicker-js"/>
     <script type="text/javascript">
         layui.use('laydate', function () {

             function getMonthStart() {
                 var now = new Date(); // 获取当前日期时间
                 var monthStart = new Date(now.getFullYear(), now.getMonth(), 1); // 获取本月第一天的日期时间
                 var monthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59); // 获取本月最后一天的日期时间（时间为23:59:59）
                 return monthStart;
             }

             function getMonthEnd() {
                 var now = new Date(); // 获取当前日期时间
                 var monthStart = new Date(now.getFullYear(), now.getMonth(), 1); // 获取本月最后一天的日期时间
                 var monthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59); // 获取本月最后一天的日期时间（时间为23:59:59）
                 return monthEnd;
             }

             layui.laydate.render({
                 elem: '#startTime',
                 theme: 'molv',
                 trigger: 'click',
                 value: getMonthStart(),
                 type: 'datetime'
             })

             layui.laydate.render({
                 elem: '#endTime',
                 theme: 'molv',
                 value: getMonthEnd(),
                 trigger: 'click',
                 type: 'datetime'
             })
         });
     </script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:cktongji:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:cktongji:remove')}]];
        var prefix = ctx + "system/cktongji";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "窗口人员统计",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'cktjid',
                    title: '窗口统计id',
                    visible: false
                },
                {
                    field: 'ryid',
                    title: '窗口人员id',
                    visible: true
                },
                {
                    field: 'ryname',
                    title: '窗口员工姓名'
                },
                {
                    field: 'fenshu',
                    title: '分数',
                    formatter: function (value, row, index) {

                            return '100.00'

                    }
                },
                {
                    field: 'manyisum',
                    title: '满意'
                },
                {
                    field: 'taidusum',
                    title: '一般'
                },
                {
                    field: 'weijiejue',
                    title: '不满意'
                },
                {
                    field: 'nomanyihj',
                    title: '不满意合计'
                },
                {
                    field: 'mylv',
                    title: '满意率',

                    align: 'center',
                    formatter: function(value, row, index) {
                       if ( row.nomanyihj == 0 ) {
                           return  '100%'
                       }
                        if ( (row.nomanyihj+row.manyi) == 0 ) {
                            return  '100%'
                        }
                        var sum = row.nomanyihj+row.manyi ;

                         return  (row.manyi/sum)*100 + '%';
                    }


                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>